package com.sinodata.atmc.common
{
	import com.adobe.serialization.json.JSON;
	import com.sinodata.common.Application;
	import com.sinodata.common.Surface;
	
	import flash.events.Event;
	import flash.external.ExternalInterface;
	import flash.xml.XMLDocument;
	import flash.xml.XMLNode;
	
	import mx.collections.ArrayCollection;
	import mx.rpc.events.ResultEvent;
	import mx.rpc.xml.SimpleXMLEncoder;
	
	[Event(name="completeID", type="Event")]
	[Event(name="completeEWM", type="Event")]
	[Event(name="completeSAVE", type="Event")]
	[Event(name="completeSAVES", type="Event")]
	[Event(name="completeHZ", type="Event")]
	
	[Event(name="completeGZ", type="Event")]
	
	[Event(name="completecleaninfo", type="Event")]
	[Event(name="completeGZ", type="Event")]
	[Event(name="completeupdateHDDY", type="Event")]
	[Event(name="completupdateDYCS", type="Event")]
	
	
	public class CallingServer extends Surface
	{
		public function CallingServer()
		{
			
		}
		private var method:String = "atmc.Showaccount";
		
		private var _isContract:Boolean;//是否签约     false：没有签约    true：已签约
		
		private var _instanceId:String;//保存交易信息后返回序列号，用于打印回执时查询
		
		private var _receiptListInfo:String;//保存回执清单信息
		
		private var _receiptPrintInfo:String;//回单打印时查询账号信息
		
		private var  _accountList:ArrayCollection;//账号集合
		
		private var _getResult:String;//判断二维码时的返回值
		
		private var _receiptPrintDetailInfo:String;
		
		private var _receiptPrintDetailConn:ArrayCollection;
		
		private var _getKePress:String;
		
		private var _fullpayeename:String; //所有收款人全称
		
		private var _ewmresult:String;//二维码验证结果
		
		private var payeebank:Array;
		private var _receiptArr:ArrayCollection;
		private var _cc:int;
		private var _firstaccount:String;
		private var _firstfullname:String;
		private var _accountArrs:ArrayCollection;
		private var _draweeaccno:String;
		private var _pingzhenghao:String;
		private var _exchangebankno:String;
		private var _titlelist:ArrayCollection;
		private var _checkaccountlist:ArrayCollection;
		private var _titlexml:XML;
		
		private var _isAdministrator:String;
		
		private var _cleanloginresult:Object;
		
		private var _readidcardarr:ArrayCollection;
		private var _printreipt:Object;
		private var _hddypartobj:Object;
		
		
		
		public function get ewmresult():String
		{
			return _ewmresult;
		}
		
		public function set ewmresult(value:String):void
		{
			_ewmresult = value;
		}
		
		public function get hddypartobj():Object
		{
			return _hddypartobj;
		}
		
		public function set hddypartobj(value:Object):void
		{
			_hddypartobj = value;
		}
		
		public function get printreipt():Object
		{
			return _printreipt;
		}
		
		public function set printreipt(value:Object):void
		{
			_printreipt = value;
		}
		
		public function get readidcardarr():ArrayCollection
		{
			return _readidcardarr;
		}
		
		public function set readidcardarr(value:ArrayCollection):void
		{
			_readidcardarr = value;
		}
		
		public function get cleanloginresult():Object
		{
			return _cleanloginresult;
		}
		
		public function set cleanloginresult(value:Object):void
		{
			_cleanloginresult = value;
		}
		
		/**
		 *回单打印 -打印本页或打印当前项更新数据  
		 * @param updateArr
		 * 
		 */		
		public function updateDYCS(updateArr:String):void{
			var obj:Object = new Object();
			obj.type = 'updateDYCS';
			obj.updateArr = updateArr;
			Application.getInstance()
				.service
				.exec(method,obj,onResultHandupdateDYCS);
		}
		private function onResultHandupdateDYCS(event:ResultEvent):void{
			var str:String = event.result.toString();//得到服务器返回的数据
			var result:Object = com.adobe.serialization.json.JSON.decode(str)  as Object;
			this.dispatchEvent(new Event("completupdateDYCS"));
		}
		public function updateHDDY(isAgainPrint:String, starttime:String, endtime:String):void{
			var obj:Object = new Object();
			obj.type = 'receiptDetail';
			obj.account = Application.getInstance().accountNo;
			obj.isAgainPrint = isAgainPrint;
			obj.starttime = starttime;
			obj.endtime = endtime;
			obj.limit = "all";
			Application.getInstance()
				.service
				.exec(method,obj,onResultHandlerupdateHDDY);
		}
		private function onResultHandlerupdateHDDY(event:ResultEvent):void{
			var str:String = event.result.toString();//得到服务器返回的数据
			printreipt = com.adobe.serialization.json.JSON.decode(str)  as Object;
			this.dispatchEvent(new Event("completeupdateHDDY"));
		}
		/**
		 * 取得人工轧账信息
		 * 
		 */
		public function getCheckAccountInfo():void{
			var device:String = ExternalInterface.call("getDeviceBase");
			var devicestr:Array = device.split(/,/);
			var obj:Object = new Object();
			obj.type = 'cleanInfo';
			obj.deviceno = devicestr[0];//设备编号
			obj.netNum = devicestr[1];//网络号
			Application.getInstance()
				.service
				.exec(method,obj,onResultHandlerToCleanInfo);
		}
		
		private function onResultHandlerToCleanInfo(event:ResultEvent):void
		{
			var str:String = event.result.toString();//得到服务器返回的数据
			var accountobj:Object = com.adobe.serialization.json.JSON.decode(str)  as Object;
			_cleanloginresult = accountobj;
			titlelist = new ArrayCollection(accountobj.titlemap);
			checkaccountlist = new ArrayCollection(accountobj.data);
			for (var i:int = 0; i < checkaccountlist.length; i++) 
			{
				checkaccountlist[i].no = i+1;
				if(checkaccountlist[i].RESULTS == "0"){
					checkaccountlist[i].result = "未完成交易";
				}else if(checkaccountlist[i].RESULTS == "1"){
					checkaccountlist[i].result = "完成交易";
				}
				checkaccountlist[i].time = checkaccountlist[i].CREATEDATE + " " + checkaccountlist[i].CREATETIME;
				if(checkaccountlist[i].TRANTYPE == "02"){
					checkaccountlist[i].trantype = "转账支票";
				}  else if(checkaccountlist[i].TRANTYPE == "04") {
					checkaccountlist[i].trantype = "贷记凭证";
				} else if(checkaccountlist[i].TRANTYPE == "05") {
					checkaccountlist[i].trantype = "电汇凭证";
				} else if(checkaccountlist[i].TRANTYPE == "01") {
					checkaccountlist[i].trantype = "支票";
				}
			}
			this.dispatchEvent(new Event("completecleaninfo"));
		}
		/**
		 *包商 取得人工轧账信息
		 * 
		 */
		public function getCheckAccountInfoBS():void{
			//						var device:String = ExternalInterface.call("getDevice");
			//						var devicestr:Array = device.split(/,/);
			var obj:Object = new Object();
			obj.type = 'cleanInfoBS';
			//						obj.dianZiGuiYuan = devicestr[0];//虚拟柜员号
			//						obj.netNum = devicestr[1];//网络号
			obj.dianZiGuiYuan="03";
			obj.netNum = "04";//网络号
			Application.getInstance()
				.service
				.exec(method,obj,onResultHandlerToCleanInfoBS);
		}
		
		private function onResultHandlerToCleanInfoBS(event:ResultEvent):void
		{
			var str:String = event.result.toString();//得到服务器返回的数据
			var accountobj:Object = com.adobe.serialization.json.JSON.decode(str)  as Object;
			_cleanloginresult = accountobj;
			titlelist = new ArrayCollection(accountobj.titlemap);
			checkaccountlist = new ArrayCollection(accountobj.data);
			for (var i:int = 0; i < checkaccountlist.length; i++) 
			{
				checkaccountlist[i].no = i+1;
				if(checkaccountlist[i].RESULTS == "0"){
					checkaccountlist[i].result = "未完成交易";
				}else if(checkaccountlist[i].RESULTS == "1"){
					checkaccountlist[i].result = "完成交易";
				}
				checkaccountlist[i].time = checkaccountlist[i].CREATEDATE + " " + checkaccountlist[i].CREATETIME;
				//				if(checkaccountlist[i].TRANTYPE == "02"){
				//					checkaccountlist[i].trantype = "转账支票";
				//				}  else if(checkaccountlist[i].TRANTYPE == "04") {
				//					checkaccountlist[i].trantype = "贷记凭证";
				//				} else if(checkaccountlist[i].TRANTYPE == "05") {
				//					checkaccountlist[i].trantype = "电汇凭证";
				//				} else if(checkaccountlist[i].TRANTYPE == "01") {
				//					checkaccountlist[i].trantype = "支票";
				//				}
				checkaccountlist[i].trantype = "支票";
			}
			this.dispatchEvent(new Event("completecleaninfo"));
		}
		/**
		 * 刷卡时判断签约卡是否签约
		 * icCard 刷卡获得的卡号
		 * 调用此方法时需在调用的对象中添加"complete"监听，在监听事件中根据_isContract
		 * 的状态判断该卡是否签约
		 * Application.getInstance().atmc_callingServer
		 .addEventListener("complete",onComplete);
		 
		 protected function onComplete(event:Event):void
		 {
		 var isContract:Boolean = com.sinodata.common.Application.getInstance()
		 .atmc_callingServer.isContract;
		 
		 }		 
		 */ 
		public function judgeIsContractByICCard(icCard:String):void{
			var obj:Object = new Object();
			obj.cardId = icCard;
			obj.type = "1";
			Application.getInstance()
				.service
				.exec(method,obj,onResultToJudgeIsContract);
		}
		
		/**
		 * 判断签约卡是否签约的回调函数
		 */ 
		private function onResultToJudgeIsContract(event:ResultEvent):void
		{
			var str:String = event.result.toString();//得到服务器返回的数据
			var accountobj:Object = com.adobe.serialization.json.JSON.decode(str)  as Object;
			if(accountobj.data != "" && accountobj.data != null){
				accountArrs = new ArrayCollection(accountobj.data);
				firstaccount = accountArrs[0].ACCOUNT;
				firstfullname = accountArrs[0].FULLNAME;
				_isContract = true;		
			}else{
				_isContract = false;
			}
			this.dispatchEvent(new Event("completeID"));
			//			
			//			var strArr:Array = new Array();
			//			strArr = str.split("@");//分割后，strArr[0]为账号的json格式。。。strArr[1]为签约全称的格式
			//			var accountArrs:Array = com.adobe.serialization
			//				.json.JSON.decode(strArr[0].toString())  as Array;//保存签约卡下的所有账号
			//			
			//			var spiltfullname:String = strArr[1].toString()
			//				.substring(1,strArr[1].toString().indexOf("]"));
			//			 var   fullnameArr:Array = new Array();//保存签约人全称
			//			    payeebank=com.adobe.serialization
			//				.json.JSON.decode(strArr[2].toString())  as Array;
			//				
			//			fullnameArr = spiltfullname.split(",");
			//			_fullpayeename=fullnameArr[0].toString();
			//			Application.getInstance().payeeBank=payeebank	;
			//			if((accountArrs==null) || (accountArrs.length==0)){
			//				_isContract = false;
			//			}else{
			//				_isContract = true;
			//			}
			
		}
		
		public function readIDCard(icCard:String):void{
			var obj:Object = new Object();
			obj.cardId = icCard;
			obj.type = "readidcard";
			
			Application.getInstance()
				.service
				.exec(method,obj,onResultreadIDCard);
		}
		
		/**
		 * 判断签约卡是否签约的回调函数
		 */ 
		private function onResultreadIDCard(event:ResultEvent):void
		{
			var str:String = event.result.toString();//得到服务器返回的数据
			var accountobj:Object = com.adobe.serialization.json.JSON.decode(str)  as Object;
			if(accountobj.data != "" && accountobj.data != null){
				readidcardarr = new ArrayCollection(accountobj.data);
				_isContract = true;		
			}else{
				_isContract = false;
			}
			this.dispatchEvent(new Event("completeID"));
		}
		/**
		 * 输入密码验证是否正确
		 * password 为输入的密码
		 */
		public  function judgeKeyPress(username:String,password:String):void{
			var obj:Object=new Object();
			obj.username = username;
			obj.pwd=password;
			obj.type="login";
			Application.getInstance()
				.service
				.exec(method,obj,onResultPassWord);
		}
		private function onResultPassWord(event:ResultEvent):void{
			var str:String = event.result.toString();//得到服务器返回的数据
			var accountobj:Object = com.adobe.serialization.json.JSON.decode(str)  as Object;
			cleanloginresult=accountobj;
			this.dispatchEvent(new Event("completeGZ"));
		}
		/**
		 * 判断非ID卡用户登陆
		 * name 开户人名称
		 * account 开户人账号
		 * 
		 */
		public function judgePayee(name:String,account:String,bank:String):void{
			var obj:Object=new Object();
			obj.payeename=name;
			obj.payeeaccount=account;
			obj.payeebank=bank;
			obj.type="payinput";
			Application.getInstance()
				.service
				.exec(method,obj,onResultPayee);
		}
		private function onResultPayee(event:ResultEvent):void{
			var str:String =event.result.toString();
			var strArr:Array = new Array();
			strArr=str.split(",");
			if((strArr==null) || (strArr.length==0)){
				_isContract = false;
				Application.getInstance().p_account=strArr[0];
				Application.getInstance().payee=str[1];
				Application.getInstance()._payeeBank=str[2];
			}else{
				_isContract = true;
			}
			this.dispatchEvent(new Event("completePayee"));
		}
		
		/**
		 * 该方法用于将扫描到的票据影像编码及交易信息传到服务器端
		 * 
		 * dealInfo 交易信息，其中dealInfo中包含
		 * 
		 * image1:票据正面影响信息
		 * image2:票据背面影响信息
		 * trans_type:票据类型   01表示支票，02表示贷记凭证，03表示结算任务申请书，04表示同城支付凭证
		 * deviceno：设备编号
		 * netnum：网点编号
		 * result：操作结果  “1”表示正常交易   “0”表示异常交易
		 * dianZiGuiYuan: 电子柜员号（虚拟柜员号）
		 * currentaccount：当前操作账号
		 * 
		 * haspsw:是否有支付密码 
		 * peopletype:持票人类型
		 * phonenum:联系人手机号码
		 * idcnum:身份证号码
		 * idcname:身份证姓名
		 * payeebk:收款人开户行
		 * payerbk:付款人开户行
		 * isewmpass:二维码验证是否通过
		 * flag:本次交易的状态
		 * 
		 * image3:进账单正面影像
		 * image4：进账单背面影像
		 * launchsite：发起网点好
		 * payingmark：收付款标记
		 * quickmark：二维码
		 * diwencheck：底纹验证是否通过
		 * 
		 * checkmount:支票数
		 * jzdmount:进账单数
		 * systemtype:对应集中处理系统业务类型
		 */
		public function saveCheck(dealInfo:Object):void{
			var obj:Object = new Object();
			//obj = dealInfo;
			obj.image1=dealInfo.image1;
			obj.image2=dealInfo.image2;
			obj.trans_type=dealInfo.trans_type;
			obj.deviceno=dealInfo.deviceno;
			obj.netnum=dealInfo.netnum;
			obj.result=dealInfo.result;
			obj.dianZiGuiYuan=dealInfo.dianZiGuiYuan;
			obj.currentaccount=dealInfo.currentaccount;
			
			obj.haspsw = dealInfo.haspsw;
			obj.peopletype = dealInfo.peopletype;
			obj.phonenum = dealInfo.phonenum;
			obj.idcnum = dealInfo.idcnum;
			obj.idcname = dealInfo.idcname;
			obj.payeebk = dealInfo.payeebk;
			obj.payerbk = dealInfo.payerbk;
			obj.isewmpass = dealInfo.isewmpass;
			obj.draweeaccno = dealInfo.draweeaccno;
			obj.flag = dealInfo.flag;
			obj.pingzhenghao = dealInfo.pingzhenghao;
			obj.exchangebankno = dealInfo.exchangebankno;
			
			//后加字段
			obj.launchsite = dealInfo.launchsite;
			obj.payingmark = dealInfo.payingmark;
			obj.quickmark = dealInfo.quickmark;
			obj.diwencheck = dealInfo.diwencheck;
			obj.image3 = dealInfo.image3;
			obj.image4 = dealInfo.image4;
			
			obj.checkmount = dealInfo.checkMount;
			obj.jzdmount = dealInfo.jzdMount;
			obj.systemtype = dealInfo.systemtype;
			
			obj.type = 'saveCheck';
			Application.getInstance().service.exec(method,obj,onResultToSaveCheck);
		}
		
		/**
		 * 保存交易信息后的回调
		 */ 
		private function onResultToSaveCheck(event:ResultEvent):void
		{
			var str:String = event.result.toString();
			var accountobj:Object = com.adobe.serialization.json.JSON.decode(str)  as Object;
			instanceId = accountobj.instanceid;
			this.dispatchEvent(new Event("completeSAVE"));
			return;
			//判断是否打印回执
			
			
		}	
		
		
		
		/**
		 * 该方法用于将扫描到的票据影像编码及交易信息传到服务器端
		 * 
		 * dealInfo 交易信息，其中dealInfo中包含
		 * 
		 * image1:票据正面影响信息
		 * image2:票据背面影响信息
		 * trans_type:票据类型   01表示支票，02表示贷记凭证，03表示结算任务申请书，04表示同城支付凭证
		 * deviceno：设备编号
		 * netnum：网点编号
		 * result：操作结果  “1”表示正常交易   “0”表示异常交易
		 * dianZiGuiYuan: 电子柜员号（虚拟柜员号）
		 * currentaccount：当前操作账号
		 * 
		 * haspsw:是否有支付密码 
		 * peopletype:持票人类型
		 * phonenum:联系人手机号码
		 * idcnum:身份证号码
		 * idcname:身份证姓名
		 * payeebk:收款人开户行
		 * payerbk:付款人开户行
		 * isewmpass:二维码验证是否通过
		 * flag:本次交易的状态
		 * 
		 * image3:进账单正面影像
		 * image4：进账单背面影像
		 * launchsite：发起网点好
		 * payingmark：收付款标记
		 * quickmark：二维码
		 * diwencheck：底纹验证是否通过
		 * 
		 * checkmount:支票数
		 * jzdmount:进账单数
		 * systemtype:对应集中处理系统业务类型
		 */
		public function saveChecks(dealInfo:Object):void{
			var obj:Object = new Object();
			//obj = dealInfo;
			obj.image1=dealInfo.image1;
			obj.image2=dealInfo.image2;
			obj.trans_type=dealInfo.trans_type;
			obj.deviceno=dealInfo.deviceno;
			obj.netnum=dealInfo.netnum;
			obj.result=dealInfo.result;
			obj.dianZiGuiYuan=dealInfo.dianZiGuiYuan;
			obj.currentaccount=dealInfo.currentaccount;
			
			obj.haspsw = dealInfo.haspsw;
			obj.peopletype = dealInfo.peopletype;
			obj.phonenum = dealInfo.phonenum;
			obj.idcnum = dealInfo.idcnum;
			obj.idcname = dealInfo.idcname;
			obj.payeebk = dealInfo.payeebk;
			obj.payerbk = dealInfo.payerbk;
			obj.isewmpass = dealInfo.isewmpass;
			obj.draweeaccno = dealInfo.draweeaccno;
			obj.flag = dealInfo.flag;
			obj.pingzhenghao = dealInfo.pingzhenghao;
			obj.exchangebankno = dealInfo.exchangebankno;
			
			//后加字段
			obj.launchsite = dealInfo.launchsite;
			obj.payingmark = dealInfo.payingmark;
			obj.quickmark = dealInfo.quickmark;
			obj.diwencheck = dealInfo.diwencheck;
			obj.image3 = dealInfo.image3;
			obj.image4 = dealInfo.image4;
			
			obj.checkmount = dealInfo.checkMount;
			obj.jzdmount = dealInfo.jzdMount;
			obj.systemtype = dealInfo.systemtype;
			
			obj.type = 'saveCheck';
			Application.getInstance().service.exec(method,obj,onResultToSaveChecks);
		}
		
		/**
		 * 保存交易信息后的回调
		 */ 
		private function onResultToSaveChecks(event:ResultEvent):void
		{
			var str:String = event.result.toString();
			var accountobj:Object = com.adobe.serialization.json.JSON.decode(str)  as Object;
			instanceId = accountobj.instanceid;
			this.dispatchEvent(new Event("completeSAVES"));
			return;
			//判断是否打印回执
			
			
		}	
		
		/**
		 * 包商银行储存交易信息
		 * 该方法用于将扫描到的票据影像编码及交易信息传到服务器端
		 * 
		 * dealInfo 交易信息，其中dealInfo中包含
		 * image1:票据正面影响信息
		 * image2:票据背面影响信息
		 * trans_type:票据类型   01表示支票，02表示贷记凭证，03表示结算任务申请书，04表示同城支付凭证
		 * deviceno：设备编号
		 * netnum：网点编号
		 * result：操作结果  “1”表示正常交易   “0”表示异常交易
		 * dianZiGuiYuan: 电子柜员号（虚拟柜员号）
		 * currentaccount：当前操作账号
		 * 
		 * haspsw:是否有支付密码 
		 * payeraccount:付款人账号
		 * payerbank：付款人开户行
		 * payername：付款人姓名
		 * payeeaccount:收款人张航
		 * PayeeBank：收款人开户行
		 * payeename:收款人姓名
		 * money:交易金额
		 *  isewmpass:二维码验证是否通过
		 * flag:本次交易的状态
		 */
		public function saveCheckBS(dealInfo:Object):void{
			var obj:Object = new Object();
			//obj = dealInfo;
			obj.image1=dealInfo.image1;
			obj.image2=dealInfo.image2;
			obj.trans_type=dealInfo.trans_type;
			obj.deviceno=dealInfo.deviceno;
			obj.netnum=dealInfo.netnum;
			obj.result=dealInfo.result;
			obj.dianZiGuiYuan=dealInfo.dianZiGuiYuan;
			obj.currentaccount=dealInfo.currentaccount;
			
			obj.haspsw = dealInfo.haspsw;
			obj.payeraccount = dealInfo.payeraccount;
			obj.payerbank = dealInfo.payerbank;
			obj.payername = dealInfo.payername;
			obj.payeeaccount = dealInfo.payeeaccount;
			obj.PayeeBank = dealInfo.payeebank;
			obj.payeename = dealInfo.payeename;
			obj.money = dealInfo.money;
			obj.flag = dealInfo.flag;
			obj.pingzhenghao = dealInfo.pingzhenghao;
			obj.exchangebankno = dealInfo.exchangebankno;
			obj.isewmpass = dealInfo.isewmpass;
			obj.type = "saveCheckBS";
			Application.getInstance().service.exec(method,obj,onResultToSaveCheckBS);
		}
		
		private function onResultToSaveCheckBS(event:ResultEvent):void
		{
			var str:String = event.result.toString();
			var accountobj:Object = com.adobe.serialization.json.JSON.decode(str)  as Object;
			instanceId = accountobj.instanceid;
			this.dispatchEvent(new Event("completeSAVE"));
			//判断是否打印回执
		}	
		
		public function verifyCode(check_qrCode:String):void {
			var obj:Object = new Object();
			obj.code = check_qrCode;
			obj.type = "queryCode";
			Application.getInstance().service.exec(method,obj,onResultSuccess);
			
		}
		
		private function onResultSuccess(event:ResultEvent):void
		{
			
			var str:String = event.result.toString();
			var accountobj:Object = com.adobe.serialization.json.JSON.decode(str)  as Object;
			draweeaccno = accountobj.draweeaccno;
			pingzhenghao = accountobj.pingzhenghao;
			exchangebankno = accountobj.exchangebankno;
			ewmresult = accountobj.result;
			this.dispatchEvent(new Event("completeEWM"));
		} 
		
		
		/**
		 * 得到回执清单
		 * instanceid:根据序列查询交易的记录
		 */ 
		public function getReceiptList(instanceid:String):void{
			
			var obj:Object = new Object();
			obj.instanceid = instanceid;
			obj.type = 'receiptprint';
			
			Application.getInstance().service.exec(method,obj,onResultToGetReceiptList);
		}
		
		private function onResultToGetReceiptList(event:ResultEvent):void
		{
			var str:String = event.result.toString();
			var accountobj:Object = com.adobe.serialization.json.JSON.decode(str)  as Object;
			this._receiptListInfo = accountobj.result;
			this.dispatchEvent(new Event("completeHZ"));
		}
		
		/**
		 * 得到包商回执清单
		 * instanceid:根据序列查询交易的记录
		 */ 
		public function getReceiptListBS(instanceid:String):void{
			var obj:Object = new Object();
			obj.instanceid = instanceid;
			obj.type = 'receiptprintBS';
			Application.getInstance().service.exec(method,obj,onResultToGetReceiptListBS);
		}
		
		private function onResultToGetReceiptListBS(event:ResultEvent):void
		{
			var str:String = event.result.toString();
			var accountobj:Object = com.adobe.serialization.json.JSON.decode(str)  as Object;
			this._receiptListInfo = accountobj.result;
			this.dispatchEvent(new Event("completeHZBS"));
		}
		
		/**
		 * 选择“回单打印 ”时调用此方法，查询出该签约卡下有哪些账号
		 * 
		 */ 
		public function getAccountForReceiptPrint(icCard:String):void{
			var obj:Object = new Object();
			obj.cardId = icCard;//将读到的卡号传到服务器端
			obj.type='2';//设置查询类型    '1'表示根据iccard查询 该卡是否签约 
			//'2'表示查询出该签约卡下有哪些账号
			//'3'表示根据身份证号码查
			Application.getInstance().service
				.exec(method,obj,onResultToReceiptPrint);
		}
		
		private function onResultToReceiptPrint(event:ResultEvent):void
		{
			var str:String = event.result.toString();//得到服务器返回的数据
			var accountobj:Object = com.adobe.serialization.json.JSON.decode(str)  as Object;//将str解析为一个obj
			//			if(accountArr.length<=0){
			//				this._receiptPrintInfo="9999";
			//				this.dispatchEvent(new Event("complete"));
			//				return;
			//			}
			if(accountobj.ret == "0"){
				_accountList = new ArrayCollection(accountobj.data);
				for (var i:int = 0; i < _accountList.length; i++) 
				{
					_accountList[i].no = i+1;
				}
			}else{
				_accountList = null;
			}
			this.dispatchEvent(new Event("complete"));
		}	
		
		/**
		 *  回单打印中查询某个账号下符合条件的交易记录
		 *  receiptPrintInfo：查询的条件信息，其中包括：
		 *  account：操作账号
		 *  isAgainPrint：判断是未打印还是补打   true：表示补打   false：表示未打印
		 *  starttime：查询范围的起始时间
		 *  endtime：查询范围的终止时间
		 *  number：查询第几页
		 *  size：一页多少条记录
		 *  limit：查询的返回   "all":表示查出符合条件的全部记录    "part":查出某一页记录
		 */ 
		public function getReceiptPrintDetail(receiptPrintInfo:Object):void{
			var obj:Object = new Object();
			obj.account = receiptPrintInfo.account;
			obj.isAgainPrint = receiptPrintInfo.isAgainPrint;
			obj.starttime = receiptPrintInfo.starttime;
			obj.endtime = receiptPrintInfo.endtime;
			obj.number = receiptPrintInfo.number;
			obj.size = receiptPrintInfo.size;
			obj.limit = receiptPrintInfo.limit;
			obj.type = 'receiptDetail';
			
			Application.getInstance().service
				.exec(method,obj,onResultToReceiptPrintDetail);
		}
		
		private function onResultToReceiptPrintDetail(event:ResultEvent):void
		{
			var str:String = event.result.toString();//得到服务器返回的数据
			var accountobj:Object = com.adobe.serialization.json.JSON.decode(str)  as Object;//将str解析为一个obj
			_hddypartobj = accountobj.data;
			if(accountobj.data != "" && accountobj.data != null){
				receiptArr = new ArrayCollection(accountobj.data);
				for (var i:int = 0; i < receiptArr.length; i++) 
				{
					receiptArr[i].no = i+1;
				}
			}else{
				receiptArr = null;
			}
			
			
			cc = accountobj.cc;
			this.dispatchEvent(new Event("complete"));
		}
		
		
		public function updateDYCSAfterReceiptPrint(updateArr:Array):void{
			var obj:Object = new Object();
			obj.type = 'updateDYCS';
			obj.updateArr = updateArr;
			
			Application.getInstance().service
				.exec(method,obj,onResultToUpdateDYCS);
			
		}
		
		private function onResultToUpdateDYCS():void
		{
			this.dispatchEvent(new Event("complete"));
			
		}
		
		/**
		 *  大堂经理确认验证
		 *  username : 柜员号
		 * password: 密码
		 */ 
		public function ManagerAffirmBS(username:String,password:String):void{
			var obj:Object=new Object();
			obj.username = username;
			obj.pwd=password;
			obj.type="manageraffirm";
			Application.getInstance()
				.service
				.exec(method,obj,onResultManager);
		}
		
		private function onResultManager(event:ResultEvent):void{
			var str:String = event.result.toString();//得到服务器返回的数据
			var accountobj:Object = com.adobe.serialization.json.JSON.decode(str)  as Object;
			cleanloginresult=accountobj;
			this.dispatchEvent(new Event("getresult"));
		}
		
		public function get isContract():Boolean
		{
			return _isContract;
		}
		
		public function set isContract(value:Boolean):void
		{
			_isContract = value;
		}
		
		public function get instanceId():String
		{
			return _instanceId;
		}
		
		public function set instanceId(value:String):void
		{
			_instanceId = value;
		}
		
		public function get receiptPrintInfo():String
		{
			return _receiptPrintInfo;
		}
		
		public function set receiptPrintInfo(value:String):void
		{
			_receiptPrintInfo = value;
		}
		
		public function get receiptListInfo():String
		{
			return _receiptListInfo;
		}
		
		public function set receiptListInfo(value:String):void
		{
			_receiptListInfo = value;
		}
		
		public function get accountList():ArrayCollection
		{
			return _accountList;
		}
		
		public function set accountList(value:ArrayCollection):void
		{
			_accountList = value;
		}
		
		public function get receiptPrintDetailInfo():String
		{
			return _receiptPrintDetailInfo;
		}
		
		public function set receiptPrintDetailInfo(value:String):void
		{
			_receiptPrintDetailInfo = value;
		}
		
		public function get receiptPrintDetailConn():ArrayCollection
		{
			return _receiptPrintDetailConn;
		}
		
		public function set receiptPrintDetailConn(value:ArrayCollection):void
		{
			_receiptPrintDetailConn = value;
		}
		
		public function get getResult():String
		{
			return _getResult;
		}
		
		public function set getResult(value:String):void
		{
			_getResult = value;
		}
		public function get cc():int
		{
			return _cc;
		}
		
		public function set cc(value:int):void
		{
			_cc = value;
		}
		
		public function get fullpayeename():String
		{
			return _fullpayeename;
		}
		
		public function set fullpayeename(value:String):void
		{
			_fullpayeename = value;
		}
		
		public function get getKeyPress():String
		{
			return _getKePress;
		}
		
		public function set getKeyPress(value:String):void
		{
			_getKePress = value;
		}
		
		public function get receiptArr():ArrayCollection
		{
			return _receiptArr;
		}
		
		public function set receiptArr(value:ArrayCollection):void
		{
			_receiptArr = value;
		}
		public function get firstaccount():String
		{
			return _firstaccount;
		}
		
		public function set firstaccount(value:String):void
		{
			_firstaccount = value;
		}
		public function get firstfullname():String
		{
			return _firstfullname;
		}
		
		public function set firstfullname(value:String):void
		{
			_firstfullname = value;
		}
		public function get accountArrs():ArrayCollection
		{
			return _accountArrs;
		}
		
		public function set accountArrs(value:ArrayCollection):void
		{
			_accountArrs = value;
		}
		public function get draweeaccno():String
		{
			return _draweeaccno;
		}
		
		public function set draweeaccno(value:String):void
		{
			_draweeaccno = value;
		}
		
		public function get pingzhenghao():String
		{
			return _pingzhenghao;
		}
		
		public function set pingzhenghao(value:String):void
		{
			_pingzhenghao = value;
		}
		
		public function get exchangebankno():String
		{
			return _exchangebankno;
		}
		
		public function set exchangebankno(value:String):void
		{
			_exchangebankno = value;
		}
		
		public function get titlelist():ArrayCollection
		{
			return _titlelist;
		}
		
		public function set titlelist(value:ArrayCollection):void
		{
			_titlelist = value;
		}
		public function get checkaccountlist():ArrayCollection
		{
			return _checkaccountlist;
		}
		
		public function set checkaccountlist(value:ArrayCollection):void
		{
			_checkaccountlist = value;
		}
		
		public function get titlexml():XML
		{
			return _titlexml;
		}
		
		public function set titlexml(value:XML):void
		{
			_titlexml = value;
		}
		
		public function get isAdministrator():String
		{
			return _isAdministrator;
		}
		
		public function set isAdministrator(value:String):void
		{
			_isAdministrator = value;
		}
	}
}